#include <QtGui/QApplication>
#include "mainwindow.h"
#include "ammmanager.h"
#include "amentitymanager.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MainWindow * w = new MainWindow();
    AMMeshManager * mm = AMMeshManager::get();
    AMEntityManager * em = AMEntityManager::get();

    QObject::connect(w, SIGNAL(openOBJ(QString)),
                     mm, SLOT(importOBJ(QString)));
    QObject::connect(w, SIGNAL(openAM(QString)),
                     mm, SLOT(importAM(QString)));
    QObject::connect(w, SIGNAL(exportOBJ(QString,QString)),
                     mm, SLOT(exportOBJ(QString,QString)));
    QObject::connect(w, SIGNAL(exportAM(QString,QString)),
                     mm, SLOT(exportAM(QString,QString)));
    QObject::connect(mm, SIGNAL(meshLoaded(QString,MeshData*)),
                     w, SLOT(addModel(QString,MeshData*)));

    QObject::connect(mm, SIGNAL(meshLoaded(QString,MeshData*)),
                     em, SLOT(create(QString,MeshData*)));

    w->show();
    return a.exec();
}
